﻿using Jerky.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JerkyTest;

[TestClass]
public class TestBookmarkReplace
{
    [TestMethod]
    public void TestReplace()
    {
        var path = @"D:\Desktop\试试.docx";

        var engine = new JerkyEngine(path);
        engine.TrimNumber = true;

        var xauat = new Foo("西建大");

        var dict = new Dictionary<string, object>
        {
            ["XAUAT"] = xauat,
            ["MIFANS"] = "米粉"
        };

        var replacedTags = engine.ReplaceBookmarksAsync(dict).Result;
        
        Assert.AreEqual(5, replacedTags);
    }

}

internal class Foo
{
    private string _name;

    public Foo(string name)
    {
        _name = name;
    }

    public override string ToString()
    {
        return _name;
    }
}